#include "FITKOFMeshProcessorFASTSIM.h"
#include "FITK_Interface/FITKInterfaceMesh/FITKUnstructuredFluidMeshVTK.h"
#include "FITK_Kernel/FITKAppFramework/FITKAppFramework.h"
#include "FITK_Kernel/FITKAppFramework/FITKGlobalData.h"
#include "FITK_Component/FITKOFMeshIO/FITKOFMeshReaderFASTSIM.h"
#include "FITK_Kernel/FITKAppFramework/FITKComponents.h"
#include <QDebug>

namespace OF
{
    void FITKOFMeshProcessorFASTSIM::start(QStringList info /*= QStringList()*/)
    {
        QString path = getValue("WorkDir").toString();
        // 读取网格
        // 写出字典文件
        Interface::FITKUnstructuredMeshVTK* mesh = FITKAPP->getGlobalData()->getMeshDataFASTSIM<Interface::FITKUnstructuredMeshVTK>();
        mesh->clearMesh();
        auto ofMeshReader = FITKAPP->getComponents()->getComponentTByName<IO::FITKOFMeshReaderFASTSIM>("IO::FITKOFMeshReaderFASTSIM");
        if (ofMeshReader == nullptr) return;
        ofMeshReader->setMeshFolder(path);
        ofMeshReader->setMeshObj(mesh);
        bool ok = ofMeshReader->exec(0);
        if(ok == false)return;
    }
}
